FROM openshift/golang-builder@sha256:4820580c3368f320581eb9e32cf97aeec179a86c5749753a14ed76410a293d83 AS builder
ENV __doozer=update BUILD_RELEASE=202202160023.p0.g5863540.assembly.stream BUILD_VERSION=v4.10.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=10 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.10.0-202202160023.p0.g5863540.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=5863540 OS_GIT_VERSION=4.10.0-202202160023.p0.g5863540.assembly.stream-5863540 SOURCE_DATE_EPOCH=1643386692 SOURCE_GIT_COMMIT=5863540f44addf07e564b2e7c833c8a5f85841e7 SOURCE_GIT_TAG=5863540f4 SOURCE_GIT_URL=https://github.com/openshift/operator-framework-olm 

ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH

WORKDIR /src

COPY . .
RUN make build/registry cross

# copy and build vendored grpc_health_probe
RUN CGO_ENABLED=0 go build -mod=vendor -tags netgo -ldflags "-w" ./vendor/github.com/grpc-ecosystem/grpc-health-probe/...

FROM openshift/ose-base:v4.10.0.20220216.010142
ENV __doozer=update BUILD_RELEASE=202202160023.p0.g5863540.assembly.stream BUILD_VERSION=v4.10.0 OS_GIT_MAJOR=4 OS_GIT_MINOR=10 OS_GIT_PATCH=0 OS_GIT_TREE_STATE=clean OS_GIT_VERSION=4.10.0-202202160023.p0.g5863540.assembly.stream SOURCE_GIT_TREE_STATE=clean 
ENV __doozer=merge OS_GIT_COMMIT=5863540 OS_GIT_VERSION=4.10.0-202202160023.p0.g5863540.assembly.stream-5863540 SOURCE_DATE_EPOCH=1643386692 SOURCE_GIT_COMMIT=5863540f44addf07e564b2e7c833c8a5f85841e7 SOURCE_GIT_TAG=5863540f4 SOURCE_GIT_URL=https://github.com/openshift/operator-framework-olm 

COPY --from=builder /src/bin/* /bin/registry/
COPY --from=builder /src/grpc-health-probe /bin/grpc_health_probe

RUN ln -s /bin/registry/* /bin

RUN mkdir /registry
RUN chgrp -R 0 /registry && \
    chmod -R g+rwx /registry
WORKDIR /registry

USER 1001
EXPOSE 50051

ENTRYPOINT ["/bin/registry-server"]
CMD ["--database", "/bundles.db"]

LABEL \
        io.k8s.display-name="OpenShift Operator Registry" \
        io.k8s.description="This is a component of OpenShift Operator Lifecycle Manager and is the base for operator catalog API containers." \
        maintainer="Odin Team <aos-odin@redhat.com>" \
        summary="Operator Registry runs in a Kubernetes or OpenShift cluster to provide operator catalog data to Operator Lifecycle Manager." \
        name="openshift/ose-operator-registry" \
        com.redhat.component="operator-registry-container" \
        io.openshift.maintainer.product="OpenShift Container Platform" \
        io.openshift.maintainer.component="OLM" \
        release="202202160023.p0.g5863540.assembly.stream" \
        io.openshift.build.commit.id="5863540f44addf07e564b2e7c833c8a5f85841e7" \
        io.openshift.build.source-location="https://github.com/openshift/operator-framework-olm" \
        io.openshift.build.commit.url="https://github.com/openshift/operator-framework-olm/commit/5863540f44addf07e564b2e7c833c8a5f85841e7" \
        version="v4.10.0"

